﻿using System.ComponentModel.Composition.Hosting;
using System.Windows;
using Microsoft.Practices.Prism.MefExtensions;
using Microsoft.Practices.Prism.Modularity;
using YunBox2.Client.Foundation;
using YunBox2.Client.Infrastructure;

namespace YunBox2.Client
{
	internal class BoxBootstrapper : MefBootstrapper
	{
		protected override DependencyObject CreateShell()
		{
			return Container.GetExportedValue<MainWindow>();
		}

		protected override void InitializeShell()
		{
			base.InitializeShell();
			Application.Current.MainWindow = (MainWindow) Shell;
			Application.Current.MainWindow.Show();
		}

		protected override void ConfigureAggregateCatalog()
		{
			AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (BoxBootstrapper).Assembly));
			AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (InfrastructureModule).Assembly));
			AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (FoundationModule).Assembly));
		}

       

		protected override void ConfigureContainer()
		{
			base.ConfigureContainer();
			ClientContext.Current.PrismContainer = Container;
			
		}
	}
}